package com.wj.wjpicture.application.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wj.wjpicture.interfaces.dto.space.SpaceAddRequest;
import com.wj.wjpicture.interfaces.dto.space.SpaceQueryRequest;
import com.wj.wjpicture.domain.space.entity.Space;
import com.wj.wjpicture.domain.user.entity.User;
import com.wj.wjpicture.interfaces.vo.space.SpaceVO;
import com.baomidou.mybatisplus.extension.service.IService;


import javax.servlet.http.HttpServletRequest;

/**
* @author 20231001
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-07-18 16:07:49
*/
public interface SpaceApplicationService extends IService<Space> {

    /**
     * 创建空间
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 将查询请求转为QueryWrapper对象
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);


    /**
     * 获取空间封装
     *
     * @param space,request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 分页获取图空间封装
     *
     * @param spacePage,request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);


    /**
     * /在创建或更新空间时，需要根据空间级别自动填充限额数据
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 私有空间校验
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(User loginUser,Space space);


}
